package com.liangwj.springbootredis.RedisConfig;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer;

/**
 * <b>Description:</b> 配置 RedisTemplate 实例 <br>
 *     一般实际应用中,都是直接配置在 RedisCacheConfig.java中的
 * @author Lingwenjun
 * @date 2018/12/14-14:00
 * @version 1.0
 */
/*@Configuration
public class RedisConfig {

    *//*@Bean
    JedisConnectionFactory jedisConnectionFactory() {
        return new JedisConnectionFactory();
    }*//*

    @Bean
    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
        RedisTemplate<String, Object> template = new RedisTemplate<>();
        template.setConnectionFactory(factory);
        template.setKeySerializer(new StringRedisSerializer());
        template.setValueSerializer(new RedisObjectSerializer());
        return template;

    }
}*/
